import { onMounted } from 'vue'
import useWeixinSdk from './WXSdk'
import { userStore } from '@/store/user.store'
import { useRouter } from 'vue-router'

export class DisableShare {
    //用户仓库信息
    uStore = userStore()
    router = useRouter()
    isSubmit = false
    constructor() {
        onMounted(() => {
            this.isSubmit = false
            useWeixinSdk.disableShare()
        })
    }
    //提交操作时，防止重复点击提交
    submit(callback = (cb: () => void) => {}) {
        if (this.isSubmit) {
            return false
        }
        this.isSubmit = true
        callback(() => {
            this.isSubmit = false
        })
    }
}
